using System;
using Blazing.BusinessObjects.Cms;
using Blazing.BusinessObjects.Tagging;
using Blazing.BusinessObjects.Locations;
using System.Web.Security;

namespace Blazing.WebFacade
{
    /// <summary>
    /// A class that installs default system types and data
    /// </summary>
    public class DefaultData
    {
        public static void Install()
        {
            /**********************************************
             * Add Default Data
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
            PageType pageType = new PageType();
            pageType.Name = "ContentPage";
            pageType.Description = "General Content Page";
            pageType.IsCmsPage = true;
            pageType.Save();

            PageType pageType2 = new PageType();
            pageType2.Name = "CustomContentPage";
            pageType2.Description = "Custom Content Page";
            pageType2.IsCmsPage = false;
            pageType2.Save();

            MenuType menuType = new MenuType();
            menuType.Name = "TopNavigation";
            menuType.Description = "Top Navigation Menu";
            menuType.IsContextual = false;
            menuType.Save();

            MenuType menuType2 = new MenuType();
            menuType2.Name = "SideNavigation";
            menuType2.Description = "Side Navigation Menu";
            menuType.IsContextual = true;
            menuType2.Save();

            Currency currency = new Currency();
            currency.Code = "AUD";
            currency.Name = "Australian Dollars";
            currency.Save();

            Country country = new Country();
            country.Countrycode = "AU";
            country.Currency = currency;
            country.Name = "Australia";
            country.Save();

            Location location = new Location();
            location.Nameshort = "Australia";
            location.Namelong = "Australia";
            location.Abbr = "AUS";
            location.Save();

            State state = new State();
            state.Name = "Queensland";
            state.Abbr = "QLD";
            state.Country = country;
            state.Save();

            TaxonomyType taxonomyType = new TaxonomyType();
            taxonomyType.Name = "Internal";
            taxonomyType.Description = "An internal taxonomy definition";
            taxonomyType.Save();

            taxonomyType = new TaxonomyType();
            taxonomyType.Name = "Public";
            taxonomyType.Description = "An public taxonomy definition";
            taxonomyType.Save();

            taxonomyType = new TaxonomyType();
            taxonomyType.Name = "Images";
            taxonomyType.Description = "Image taxonomy";
            taxonomyType.Save();

            Membership.CreateUser("admin", "admin", "brendan.kowitz@gmail.com");
            Roles.CreateRole("Administrator");
            Roles.AddUserToRole("admin", "Administrator");

        }
    }
}
